<?php
namespace PsiFramework\Classes\Util\Database\Query;

import("Classes.Util.Database.SqlQuery");
import("Classes.Util.Database.Query.SqlIndex");
import("Classes.Util.Database.Query.SqlPrimaryKey");
import("Classes.Util.Database.Query.SqlForeignKey");
import("Classes.Util.Database.Query.SqlUniqueKey");

use \PsiFramework\Classes\Util\Database\SqlQuery;
use \PsiFramework\Classes\Util\Database\Query\SqlIndex;
use \PsiFramework\Classes\Util\Database\Query\SqlTable;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The SqlCreateTableQuery class allows to represent a sql create table query
 *
 * @package Util.Database
 */
class SqlCreateTableQuery extends SqlQuery
{

    protected /*SqlIndex[]*/ $_indexes ;

    /**
     * SqlCreateTableQuery constructor
     *
     * @param $table       the table concerned by the request
     * @param $parameters  the parameters of the request
     *                     (select columns for a select request,
     *                     the column/value couples for an insert
     *                     or update request)
     */
    public function __construct(
        SqlTable       $table = null,
        /*array*/      $parameters = array(),
        /*SqlIndex[]*/ $indexes=array()
    )
    {
        parent::__construct(self::$createTable, $table, null, $parameters);
        $this->_indexes = $indexes ;
    }

    public function getIndexes()
    {
        return $this->_indexes ;
    }

    public function setIndexes(/*SqlIndex[]*/ $indexes)
    {
        $this->_indexes = $indexes ;
    }

    public function addIndex(SqlIndex $index)
    {
        $this->_indexes[] = $index ;
    }

}

